home *** CD-ROM | disk | FTP | other *** search
- package java.awt;
-
- import java.awt.image.BufferStrategy;
- import java.awt.image.ImageObserver;
- import java.awt.image.VolatileImage;
- import sun.java2d.SunGraphics2D;
-
- public class Component$BltBufferStrategy extends BufferStrategy {
- protected BufferCapabilities caps;
- protected VolatileImage[] backBuffers;
- protected boolean validatedContents;
- protected int width;
- protected int height;
- private Insets insets;
- // $FF: synthetic field
- final Component this$0;
-
- protected Component$BltBufferStrategy(Component var1, int var2, BufferCapabilities var3) {
- this.this$0 = var1;
- this.caps = var3;
- this.createBackBuffers(var2 - 1);
- }
-
- public void dispose() {
- if (this.backBuffers != null) {
- for(int var1 = this.backBuffers.length - 1; var1 >= 0; --var1) {
- if (this.backBuffers[var1] != null) {
- this.backBuffers[var1].flush();
- this.backBuffers[var1] = null;
- }
- }
- }
-
- if (this.this$0.bufferStrategy == this) {
- this.this$0.bufferStrategy = null;
- }
-
- }
-
- protected void createBackBuffers(int var1) {
- if (var1 == 0) {
- this.backBuffers = null;
- } else {
- this.width = this.this$0.getWidth();
- this.height = this.this$0.getHeight();
- this.insets = Component.access$000(this.this$0);
- int var2 = this.width - this.insets.left - this.insets.right;
- int var3 = this.height - this.insets.top - this.insets.bottom;
- var2 = Math.max(1, var2);
- var3 = Math.max(1, var3);
- if (this.backBuffers == null) {
- this.backBuffers = new VolatileImage[var1];
- } else {
- for(int var4 = 0; var4 < var1; ++var4) {
- if (this.backBuffers[var4] != null) {
- this.backBuffers[var4].flush();
- this.backBuffers[var4] = null;
- }
- }
- }
-
- for(int var7 = 0; var7 < var1; ++var7) {
- this.backBuffers[var7] = this.this$0.createVolatileImage(var2, var3);
- }
- }
-
- }
-
- public BufferCapabilities getCapabilities() {
- return this.caps;
- }
-
- public Graphics getDrawGraphics() {
- this.revalidate();
- Image var1 = this.getBackBuffer();
- if (var1 == null) {
- return this.this$0.getGraphics();
- } else {
- SunGraphics2D var2 = (SunGraphics2D)var1.getGraphics();
- var2.constrain(-this.insets.left, -this.insets.top, var1.getWidth((ImageObserver)null) + this.insets.left, var1.getHeight((ImageObserver)null) + this.insets.top);
- return var2;
- }
- }
-
- Image getBackBuffer() {
- return this.backBuffers != null ? this.backBuffers[this.backBuffers.length - 1] : null;
- }
-
- public void show() {
- this.showSubRegion(this.insets.left, this.insets.top, this.width - this.insets.right, this.height - this.insets.bottom);
- }
-
- void showSubRegion(int var1, int var2, int var3, int var4) {
- if (this.backBuffers != null) {
- var1 -= this.insets.left;
- var3 -= this.insets.left;
- var2 -= this.insets.top;
- var4 -= this.insets.top;
- Graphics var5 = this.this$0.getGraphics_NoClientCode();
- if (var5 != null) {
- try {
- var5.translate(this.insets.left, this.insets.top);
-
- for(int var6 = 0; var6 < this.backBuffers.length; ++var6) {
- var5.drawImage(this.backBuffers[var6], var1, var2, var3, var4, var1, var2, var3, var4, (ImageObserver)null);
- var5.dispose();
- Object var14 = null;
- var5 = this.backBuffers[var6].getGraphics();
- }
- } finally {
- if (var5 != null) {
- var5.dispose();
- }
-
- }
-
- }
- }
- }
-
- protected void revalidate() {
- this.revalidate(true);
- }
-
- void revalidate(boolean var1) {
- this.validatedContents = false;
- if (this.backBuffers != null) {
- if (var1) {
- Insets var2 = Component.access$000(this.this$0);
- if (this.this$0.getWidth() != this.width || this.this$0.getHeight() != this.height || !var2.equals(this.insets)) {
- this.createBackBuffers(this.backBuffers.length);
- this.validatedContents = true;
- }
- }
-
- GraphicsConfiguration var4 = this.this$0.getGraphicsConfiguration_NoClientCode();
- int var3 = this.backBuffers[this.backBuffers.length - 1].validate(var4);
- if (var3 == 2) {
- if (var1) {
- this.createBackBuffers(this.backBuffers.length);
- this.backBuffers[this.backBuffers.length - 1].validate(var4);
- }
-
- this.validatedContents = true;
- } else if (var3 == 1) {
- this.validatedContents = true;
- }
-
- }
- }
-
- public boolean contentsLost() {
- return this.backBuffers == null ? false : this.backBuffers[this.backBuffers.length - 1].contentsLost();
- }
-
- public boolean contentsRestored() {
- return this.validatedContents;
- }
- }
-